<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs"> 
<head>
   <link rel="stylesheet" type="text/css" href="css/css.css"/>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
 <title>Administrace</title>
<style type="text/css">
   .modra{background-color:red;}
   .oranz{background-color:orange;}
   .ruz {background-color:pink;}
   .cer{color:red;}
   table,td{border:1px solid black;}
</style> 

</head>
<body>
 
 <p>Nyní jste v administraci, přihlášen jako <b><?php echo $_SESSION['jmeno'] ?></b>.</p>
<div id="global"><!-- Začátek Global -->
<h2>BITWA Petr Šmíd</h2>
<div id="hlavicka"><!-- Začátek hlavičky -->

</div><!-- Konec hlavičky -->
<div id="menu1"><!-- Začátek menu -->
<div id="banner1">
<h2>Další stránky</h2>


<a href="bmi.php">Nový test</a>
<a href="hledani.php">Moje Testy</a>
<a href="index.php">Odhlásit</a>

</div>
</div>
<div id="obsah"> 
 

<?php
if ($showForm){
?>



<?php
}else{ // else if ($showForm)


$con=mysql_connect("localhost", "smidpet5", "aez9okai");
// Check connection
if (!$con)
  {
  echo "Failed to connect to MySQL: " . mysql_connect_error();
  }


mysql_select_db("smidpet5");

 $id= $_SESSION['id'];
  echo"$id";
		
			                                                 
//$mm = mysql_query($query);
//$current=mysql_fetch_array($mm);
	  
//mysql_close();  
 if(isset($_REQUEST['pp']))
      {$pp=$_REQUEST['pp'];
      
          $ll = mysql_query("DELETE  FROM `BMIII` WHERE idd='$pp'", $con) ;
          
                 
      }    
$con=mysql_connect("localhost", "smidpet5", "aez9okai");
// Check connection
if (!$con)
  {
  echo "Failed to connect to MySQL: " . mysql_connect_error();
  }


mysql_select_db("smidpet5");    
$mm = mysql_query("SELECT * FROM `BMIII` WHERE id='$id'", $con) ;    
 if (!$mm) {
		    echo "Chyba:".$current['id'];
		    return false;
			}
echo "<table>";echo "<tr>";echo "<th>";echo "Datum";echo "</th>";echo "<th>";echo "BMI";echo "</th>";echo "</tr>";
	 	
while ($current=mysql_fetch_array($mm, MYSQL_ASSOC)){ 
			echo "<tr>";
			echo "<td>";
			echo $current["Datum"];
			echo "</td>";
			echo "<td>";
			echo $current["BMI"];
			echo "</td>";
      echo "<td>";
		  echo "<a href=\"detaili.php?pp=".$current['idd']."\">Detail meho testu</a>";
			echo "</td>";  
       echo "<td>";
		  echo "<a href=\"hledani.php?pp=".$current['idd']."\">Odstran</a>";
			echo "</td>";        
			echo "</tr>";			
		} 
		
		echo "</table>";        
}   

  
?>
</div><!-- Konec obsahu -->
</div> <!-- Konec Global -->
<div id="pata" style="text-align: center"> <!-- Začátek pata -->  
Úkol vypracoval: Petr Šmíd
</div><!-- Konec pata -->


</body>
</html>